package com.ftg.learn.framework.mybatis;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

/**
 * 练习
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/9/4 上午11:11
 */
public class MybatisExample {

    // cv 3
    public static void main(String[] args) throws IOException {

//        mybatis google (钱 收) [ibatis louts] ...  mybatis

        String resource = "zong.xml";
        InputStream inputStream = Resources.getResourceAsStream(resource);

        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);

        SqlSession session = sqlSessionFactory.openSession();
        int n = session.update("first.update");
        System.out.println(n+"几条");

//
        System.out.println(session.selectList("first.showall"));

    }

}
